/**
 * Created by charlie on 18-1-17.
 */
import React from 'react'
import UI from '../components/taskCenter'
import {connect} from 'dva-no-router'
import {bindActionCreators} from 'redux'
import {View} from 'react-native'

class TaskCenter extends React.Component {
    componentWillMount(){
        const {getTableListNoReceive}=this.props;
        getTableListNoReceive();
      const {cleanData}=this.props;
      cleanData();
    }
    componentWillUnmount(){
      const {getClean}=this.props;
      getClean();
    }

    render(){
        return(
            <UI  {...this.props} />
        )
    }
}

const actions ={
    getTableListNoReceive:() =>({type:'taskCenter/getTableListNoReceive'}),
    tabChange:(val) =>({type:'taskCenter/tabChange',payload:val}),
  cleanData: () => ({type: 'taskCenter/cleanData'}),
    getClean:() =>({type:'taskCenter/getClean'}),
    receiveTask:(val1,val2,val3) =>({type:'taskCenter/receiveTask',payload:{taskId:val1,taskNum:val2,name:val3}}),
    setTaskNewId:(val) =>({type:'taskCenter/setTaskNewId',payload:val}),
    getTaskId: (val) => ({type: 'taskReceive/getTaskId', payload: val}),
    thisPersonSelect:(val) =>({type:'taskCenter/thisPersonSelect',payload:val}),
    thisTaskReceive:(val) =>({type:'taskCenter/thisTaskReceive',payload:val}),
    thisTaskCancle:(val) =>({type:'taskCenter/thisTaskCancle',payload:val}),
};
const mapProps = ({taskCenter}) =>({taskCenter});
const mapActions = dispatch =>({
    ...bindActionCreators({...actions},dispatch)
});
export default connect (mapProps,mapActions)(TaskCenter)